import 'dart:convert' show json;
import 'comment.dart';

class ItemData {
  int cache_version;
  int t;
  String bimageuri;
  String bookmark;
  String cai;
  String cdn_img;
  String comment;
  String create_time;
  String created_at;
  String ding;
  String favourite;
  String gifFistFrame;
  String hate;
  String height;
  String id;
  String image0;
  String image1;
  String image2;
  String is_gif;
  String love;
  String name;
  String original_pid;
  String passtime;
  String profile_image;
  String repost;
  String screen_name;
  String status;
  String tag;
  String text;
  String theme_id;
  String theme_name;
  String theme_type;
  String type;
  String user_id;
  String videotime;
  String videouri;
  String voicelength;
  String voicetime;
  String voiceuri;
  String weixin_url;
  String width;
  List<dynamic> themes;
  Comment top_cmt;

  ItemData.fromParams(
      {this.cache_version,
      this.t,
      this.bimageuri,
      this.bookmark,
      this.cai,
      this.cdn_img,
      this.comment,
      this.create_time,
      this.created_at,
      this.ding,
      this.favourite,
      this.gifFistFrame,
      this.hate,
      this.height,
      this.id,
      this.image0,
      this.image1,
      this.image2,
      this.is_gif,
      this.love,
      this.name,
      this.original_pid,
      this.passtime,
      this.profile_image,
      this.repost,
      this.screen_name,
      this.status,
      this.tag,
      this.text,
      this.theme_id,
      this.theme_name,
      this.theme_type,
      this.type,
      this.user_id,
      this.videotime,
      this.videouri,
      this.voicelength,
      this.voicetime,
      this.voiceuri,
      this.weixin_url,
      this.width,
      this.themes,
      this.top_cmt});

  ItemData.fromJson(jsonRes) {
    if (jsonRes.toString() == "[]" || jsonRes.toString() == "") {
      return;
    }
    print(jsonRes);
    cache_version = jsonRes['cache_version'];
    t = jsonRes['t'];
    bimageuri = jsonRes['bimageuri'];
    bookmark = jsonRes['bookmark'];
    cai = jsonRes['cai'];
    cdn_img = jsonRes['cdn_img'];
    comment = jsonRes['comment'];
    create_time = jsonRes['create_time'];
    created_at = jsonRes['created_at'];
    ding = jsonRes['ding'];
    favourite = jsonRes['favourite'];
    gifFistFrame = jsonRes['gifFistFrame'];
    hate = jsonRes['hate'];
    height = jsonRes['height'];
    id = jsonRes['id'];
    image0 = jsonRes['image0'];
    image1 = jsonRes['image1'];
    image2 = jsonRes['image2'];
    is_gif = jsonRes['is_gif'];
    love = jsonRes['love'];
    name = jsonRes['name'];
    original_pid = jsonRes['original_pid'];
    passtime = jsonRes['passtime'];
    profile_image = jsonRes['profile_image'];
    repost = jsonRes['repost'];
    screen_name = jsonRes['screen_name'];
    status = jsonRes['status'];
    tag = jsonRes['tag'];
    text = jsonRes['text'];
    theme_id = jsonRes['theme_id'];
    theme_name = jsonRes['theme_name'];
    theme_type = jsonRes['theme_type'];
    type = jsonRes['type'];
    user_id = jsonRes['user_id'];
    videotime = jsonRes['videotime'];
    videouri = jsonRes['videouri'];
    voicelength = jsonRes['voicelength'];
    voicetime = jsonRes['voicetime'];
    voiceuri = jsonRes['voiceuri'];
    weixin_url = jsonRes['weixin_url'];
    width = jsonRes['width'];
    themes = jsonRes['themes'] == null ? null : [];

    for (var themesItem in themes == null ? [] : jsonRes['themes']) {
      themes.add(themesItem);
    }

    top_cmt = jsonRes['top_cmt'] == null
        ? null
        : new Comment.fromJson(jsonRes['top_cmt']);
  }

  @override
  String toString() {
    return '{"cache_version": $cache_version,"t": $t,"bimageuri": ${bimageuri != null ? '${json.encode(bimageuri)}' : 'null'},"bookmark": ${bookmark != null ? '${json.encode(bookmark)}' : 'null'},"cai": ${cai != null ? '${json.encode(cai)}' : 'null'},"cdn_img": ${cdn_img != null ? '${json.encode(cdn_img)}' : 'null'},"comment": ${comment != null ? '${json.encode(comment)}' : 'null'},"create_time": ${create_time != null ? '${json.encode(create_time)}' : 'null'},"created_at": ${created_at != null ? '${json.encode(created_at)}' : 'null'},"ding": ${ding != null ? '${json.encode(ding)}' : 'null'},"favourite": ${favourite != null ? '${json.encode(favourite)}' : 'null'},"gifFistFrame": ${gifFistFrame != null ? '${json.encode(gifFistFrame)}' : 'null'},"hate": ${hate != null ? '${json.encode(hate)}' : 'null'},"height": ${height != null ? '${json.encode(height)}' : 'null'},"id": ${id != null ? '${json.encode(id)}' : 'null'},"image0": ${image0 != null ? '${json.encode(image0)}' : 'null'},"image1": ${image1 != null ? '${json.encode(image1)}' : 'null'},"image2": ${image2 != null ? '${json.encode(image2)}' : 'null'},"is_gif": ${is_gif != null ? '${json.encode(is_gif)}' : 'null'},"love": ${love != null ? '${json.encode(love)}' : 'null'},"name": ${name != null ? '${json.encode(name)}' : 'null'},"original_pid": ${original_pid != null ? '${json.encode(original_pid)}' : 'null'},"passtime": ${passtime != null ? '${json.encode(passtime)}' : 'null'},"profile_image": ${profile_image != null ? '${json.encode(profile_image)}' : 'null'},"repost": ${repost != null ? '${json.encode(repost)}' : 'null'},"screen_name": ${screen_name != null ? '${json.encode(screen_name)}' : 'null'},"status": ${status != null ? '${json.encode(status)}' : 'null'},"tag": ${tag != null ? '${json.encode(tag)}' : 'null'},"text": ${text != null ? '${json.encode(text)}' : 'null'},"theme_id": ${theme_id != null ? '${json.encode(theme_id)}' : 'null'},"theme_name": ${theme_name != null ? '${json.encode(theme_name)}' : 'null'},"theme_type": ${theme_type != null ? '${json.encode(theme_type)}' : 'null'},"type": ${type != null ? '${json.encode(type)}' : 'null'},"user_id": ${user_id != null ? '${json.encode(user_id)}' : 'null'},"videotime": ${videotime != null ? '${json.encode(videotime)}' : 'null'},"videouri": ${videouri != null ? '${json.encode(videouri)}' : 'null'},"voicelength": ${voicelength != null ? '${json.encode(voicelength)}' : 'null'},"voicetime": ${voicetime != null ? '${json.encode(voicetime)}' : 'null'},"voiceuri": ${voiceuri != null ? '${json.encode(voiceuri)}' : 'null'},"weixin_url": ${weixin_url != null ? '${json.encode(weixin_url)}' : 'null'},"width": ${width != null ? '${json.encode(width)}' : 'null'},"themes": $themes,"top_cmt": $top_cmt}';
  }
}
